﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Ver1.Controllers
{
    public class RoundController : Controller
    {
        //
        // GET: /Round/
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult quayso()
        {
            return View();
        }
        public ActionResult phoi()
        {
            return View();
        }

        public ActionResult dinhhinh()
        {
            return View();
        }
        public ActionResult laprap1()
        {
            return View();
        }

        public ActionResult laprap2()
        {
            return View();
        }

        public ActionResult chanhamtho()
        {
            return View();
        }

        public ActionResult chanhamtinh()
        {
            return View();
        }

        public ActionResult nguoi1()
        {
            return View();
        }

        public ActionResult nguoi2()
        {
            return View();
        }

        public ActionResult nguoi3()
        {
            return View();
        }

        public ActionResult nguoi4()
        {
            return View();
        }

        public ActionResult son1()
        {
            return View();
        }

        public ActionResult son2()
        {
            return View();
        }

        public ActionResult sonlaprap1()
        {
            return View();
        }

        public ActionResult sonlaprap2()
        {
            return View();
        }

        public ActionResult donghoi1()
        {
            return View();
        }

        public ActionResult donggoi2()
        {
            return View();
        }

        public ActionResult QC()
        {
            return View();
        }

        public ActionResult lencont()
        {
            return View();
        }

        public ActionResult tomau()
        {
            return View();
        }

        public ActionResult codien()
        {
            return View();
        }

        public ActionResult tapvu()
        {
            return View();
        }

        public ActionResult vanphong()
        {
            return View();
        }

        public ActionResult vanphongxuong()
        {
            return View();
        }

               public ActionResult Run()
        {
            string allChar = "0,1,2,3,4,5,6,7,8,9";
            string[] allCharArray = allChar.Split(',');
            string randomCode = "";
            int temp = -1;
            Random rand = new Random();
            for (int i = 0; i < 6; i++)
            {
                if (temp != -1)
                {
                    rand = new Random(i * temp * ((int)DateTime.Now.Ticks));
                    
                }
                int t = rand.Next(10);
                temp = t;
                randomCode += allCharArray[t];
                ViewBag.quay = t;
            }
            ViewBag.kq=randomCode;
            return View("Index");
        }

        public ActionResult Runmang()
        {
            string path = Server.MapPath("~/Data/Nguoi1.txt");
            string[] lines = System.IO.File.ReadAllLines(path);
            String[] contents = System.IO.File.ReadAllLines(path);

            ViewBag.Contents = contents;
            ViewBag.Contentslength = contents.Length;
           // ViewBag.id = lines[0];
            //ViewBag.name = lines[1];
            //string allChar = "0000,1000,2000,3000,4234,5456,6784,7210,8124,1210,4523,0110,1666";
            //string allChar = lines;
            //string[] allCharArray = allChar.Split(',');
            string randomCode = "";
            int temp = -1;
            Random rand = new Random();
            for (int i = 0; i <lines.Length; i++)
            {
                if (temp != -1)
                {
                    rand = new Random(i * temp * ((int)DateTime.Now.Ticks));

                }
                int t = rand.Next(lines.Length);
                temp = t;
                //randomCode = allCharArray[t];
                randomCode = lines[t];
                ViewBag.kq2 = t;
            }
            ViewBag.kq1 = randomCode;
           
            
            return View("Index");
        }
        
	}
}